BYTE = 1
WORD = 2

Structure_Operation_Center 			= 0
Structure_Transformation_Gateway 	= 1
Structure_Point_Defense 			= 2
Structure_AA_Defense 				= 3
Structure_Universal_Defense 		= 4
Strucutre_Refinery 					= 5
Structure_Detector 					= 6
Structure_Watchtower 				= 7
Structure_Argo_Laboratory 			= 8
Structure_Factory 					= 9
Structure_Starbase 					= 10
Structure_Armory					= 11
Structure_Command_Center 			= 12
Structure_Manhatton_Center 			= 13
Structure_Quantum_Facility 			= 14
Structure_ACC 						= 15

;object code structure
X_Position  = 0
Width = X_Position + WORD
Y_Position	= Width + BYTE
Height = Y_Position + WORD
Structure_Type = Height + BYTE
HP = Structure_Type + BYTE
Building_Time = HP + WORD
;Width, Height (2 bytes, 1 for each)

<<<<<<< .mine
ObjectSize = Building_Time + WORD
=======
Structure_X_Position .equ 0
Structure_Y_Position .equ 2
Structure_Type_ID .equ 4
Structure_HP .equ 5
Structure_Building_Time .equ 7
Structure_Width .equ 9
Structure_Height .equ 10
>>>>>>> .r42

<<<<<<< .mine
Object_Count = appbackupscreen+303
Object_End = Object_Count + WORD
=======
>>>>>>> .r42

<<<<<<< .mine
DrawStructures:
	ld hl,(object_end)
	ld de,objects
	or a
	sbc hl,de
	ret z
	di
	;we have objects to draw
	ld ix,objects
NextObject
	push ix
	ld de,objectsize
	add ix,de
	ex (sp),ix				;ohsheet too awesome ;)
	ld de,(MapY)
	ld l,(ix+Y_Position)
	ld h,(ix+Y_Position+1)
	or a
	sbc hl,de
	ex de,hl
	ld bc,(MapX)
	ld l,(ix+X_Position)
	ld h,(ix+X_Position+1)
	or a
	sbc hl,bc
	ld d,l
	;d = x, e = y
	ld a,(ix+structure_type)
	add a,a				;4
	ld b,0				;7
	ld c,a				;4
	ld hl,Structure_Graphics_Addresses
	add hl,bc
	ld hl,a,(hl)
	ld c,(ix+width)
	ld b,(ix+height)	
	push hl
	push hl
	pop ix
	pop iy
	push de
		ld h,b
		ld e,c
		call multhbye
		ex de,hl
		add iy,de
	pop de
	call largeclippedsprite
DrawNextObject
	pop de
	ld hl,(object_end)
	or a
	sbc hl,de
	ret z
	push de
	pop ix
	jp NextObject
=======




;Stores all the graphics for drawing buildings for optimization purposes
Structure_Graphics_Addresses .equ $9D95 + 9000
>>>>>>> .r42

<<<<<<< .mine
;a = object type to add
;de = x
;bc = y
AddObject:
	ld hl,(Object_End)
	ld (hl+),e
	ld (hl+),d					;x
	ld d,a
	call getstructwidth
	ld (hl+),a					;width
	ld (hl+),c
	ld (hl+),b					;y
	ld a,d
	call getstructheight
	ld (hl+),a					;height
	ld a,d
	ld (hl+),a					;type
	call getstructhp
	ld (hl+),c
	ld (hl+),b					;hp
	call getstructtime
	ld (hl+),c
	ld (hl+),b					;build time
	ld (Object_End),hl
	ret
=======
>>>>>>> .r42

<<<<<<< .mine
;de = x
;bc = y
DeleteObject:
	;meh who cares
	ret
=======

Structure_Operation_Center .equ 0
Structure_Transformation_Gateway .equ 1
Structure_Point_Defense .equ 2
Structure_AA_Defense .equ 3
Structure_Universal_Defense .equ 4
Strucutre_Refinery .equ 5
Structure_Detector .equ 6
Structure_Watchtower .equ 7
Structure_Argo_Laboratory .equ 8
Structure_Factory .equ 9
Structure_Starbase .equ 10
Structure_Armory .equ 11
Structure_Command_Center .equ 12
Structure_Manhatton_Center .equ 13
Structure_Quantum_Facility .equ 14
Structure_ACC .equ 15
>>>>>>> .r42

;TODO: really get this value
GetStructHP:
	ld bc,20
	ret

;TODO: really get this value
GetStructTime:
	ld bc,10
	ret
	
GetStructWidth:
	ld a,4
	ret

GetStructHeight:
	ld a,32
	ret

<<<<<<< .mine
; HL = H x E
MultHbyE:
	push bc
	ld d,0
	ld l,d
	ld b,8
_
	add hl,hl		; Get most-significant bit of HL
	jr nc,_
	add hl,de
_
	djnz --_
	pop bc
	ret
	
Structure_Graphics_Addresses:
.dw Sprite_Operation_Center
.dw Sprite_Transformation_Gateway
.dw Sprite_Point_Defense
.dw Sprite_AA_Defense
.dw Sprite_Universal_Defense
.dw Sprite_Refinery
.dw Sprite_Detector
.dw Sprite_Watchtower
.dw Sprite_Argo_Laboratory
.dw Sprite_Factory
.dw Sprite_Starbase
.dw Sprite_Armory
.dw Sprite_Command_Center
.dw Sprite_Manhatton_Center
.dw Sprite_Quantum_Facility
.dw Sprite_ACC
#include "objectdata.asm"=======
; Ram Locations.

;Location for holding where structures are placed

Structures .equ 0 	;For 50 structures, this requires
			;550 bytes

 jp Start

 .db 0



 .dw Load_Sprite_Data
 .db 1

 .dw Load_Map_Data
 .db 2

 .dw Load_Tile_Data
 .db 3

_Load_Sprite_Data .equ 44*3
_Load_Map_Data .equ 45*3
_Load_Tile_Data .equ 46*3








>>>>>>> .r42
